<%-- 
    Document   : login
    Created on : 11-11-2014, 22:32:47
    Author     : Rodrigo
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<c:set var="contextPath" value="${pageContext.servletContext.contextPath}"/>

<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
        <title>Iniciar sesión en E-Praxis</title>
        <link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" href="${contextPath}/css/font-awesome.min.css">
        <link rel="stylesheet" href="${contextPath}/css/epraxis.css">
        <style type="text/css">
            #btnLogin{
                margin-top: 10px
            }

            .input-group{
                margin-top: 10px
            }


        </style>
    </head>
    <body class="body-login">
        <div class="container-fluid">
            <div class="row">
                <div class="col-md-12">
                    <h1 class="text-center text" style="margin-top: 10%">
                        <em><strong>E-praxis</strong></em>
                    </h1>
                    <span class="help-block text-center">
                        Escriba su e-mail y contraseña para iniciar sesión en el sistema
                    </span>
                </div>
            </div>
            <div class="row" class="height-50-percent">
                <div class="col-md-4 col-md-offset-4 col-xs-12 col-sm-12">
                    <form id="formIniciarSesion" role="form">
                        <div class="form-group">
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-user"></i></span>
                                <input name="nombreUsuario" type="text" class="form-control" placeholder="E-mail">
                            </div>
                            <div class="input-group">
                                <span class="input-group-addon"><i class="fa fa-asterisk"></i></span>
                                <input name="clave" type="password" class="form-control" placeholder="Contraseña">
                            </div>
                            <a href="#" class="pull-left">Olvidé mi contraseña</a>
                            <button id="btnLogin" type="button" onclick="iniciarSesion();" class="btn btn-default pull-right">Iniciar sesión</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>

        <script src="${contextPath}/js/jquery-2.1.1.js"></script>
        <script src="${contextPath}/js/bootstrap.min.js"></script>
        <script src="${contextPath}/js/epraxis.js">
        </script>
        <script>
            function iniciarSesion() {
                var controller = '${contextPath}/app/commons/IniciarSesion.do';
                var parametros = $('#formIniciarSesion').serialize();

                get(controller, parametros, function(data, isError) {
                    if (isError) {
                        alert(data);
                    } else {
                        document.location = '${contextPath}/app/Home.view';
                    }
                });
            }
        </script>
    </body>
</html>
